package zoo;

import java.util.ArrayList;
import java.util.List;

public class AnimalArea {
    private String areaName;
    private int areaid;
    public AnimalArea(String areaName, int areaid){
        this.areaName = areaName;
        this.areaid = areaid;
    }
    private List<Animal> zooAnimal=new ArrayList<Animal>();
    //添加动物
    public void addZooAnimal(Animal animal) {
        zooAnimal.add(animal);
    }
    public void addAnimal(List<Animal> animals) {
        zooAnimal.addAll(animals);
    }
    //删除指定动物
    public void removeZooAnimal(Animal animal) {
        zooAnimal.remove(animal);
    }
    public void remmoveZooAnimal(String animalName) {
        for (Animal animal : zooAnimal) {
            if (animal.getName().equals(animalName)) {
                zooAnimal.remove(animal);
            }
        }
    }
    public void remmoveZooAnimal(int animalId) {
        for (Animal animal : zooAnimal) {
            if (animal.getId() == animalId) {
                zooAnimal.remove(animal);
            }
        }
    }
    //打印动物信息
    public void printZooAnimal() {
        for (Animal animal : zooAnimal) {
            System.out.println(animal.getName()+" "+animal.getAge()+"岁"+"id:"+animal.getId());
        }
    }
    //查询动物信息
    public boolean searchZooAnimal(String animalName) {
        for (Animal animal : zooAnimal) {
            if (animal.getName().equals(animalName)) {
                return true;
            }
        }
        return false;
    }
    public void getBreeder(Animal animal){
        System.out.println(animal.getZooBreeder());
    }
    public void getBreeder(String animalName){
        for (Animal animal : zooAnimal) {
            if (animal.getName().equals(animalName)) {
                System.out.println(animal.getName()+"的饲养员是"+animal.getZooBreeder());
            }
        }
    }
    public int getAreaid() {
        return areaid;
    }

    public void setAreaid(int areaid) {
        this.areaid = areaid;
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }
}
